package viewmodel;

import java.util.ArrayList;
import java.util.List;

import admin.dao.GameDAO;

import model.Game;

public class GameDataModel {
	private List<Game> allGame = new ArrayList<Game>();
	
	public GameDataModel(){
		updateAllGame();
	}
	
	public void updateAllGame(){
		this.allGame = GameDAO.getAllGame();
	}
	public void removeGame(Game selGame){
		allGame.remove(selGame);
	}
	
	public static List<GamesEditStatus> convertGameToEditData(List<Game> listGame){
		ArrayList<GamesEditStatus> result = new ArrayList<GamesEditStatus>();
		for(Game game : listGame){
			GamesEditStatus gameEdit = new GamesEditStatus(game, false);
			result.add(gameEdit);
		}
		return result;
	}
	public List<GamesEditStatus> convertGameToEditData(){
		return GameDataModel.convertGameToEditData(allGame);
	}
}
